package cn.tedu.spring.example;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author tune_the last
 * @date 2025/11/6 - 10:52
 * 测试类
 */
public class TestUser {
    public static void main(String[] args) {
        /*
            1.框架扫描到User类：cn.tedu.spring.example包
            2.从IOC容器中获取所需要的对象
            3.测试执行
         */
        ApplicationContext context = new AnnotationConfigApplicationContext("cn.tedu.spring.example");
        User user = context.getBean(User.class);
        user.doSome();


        /*
            xml方式
         */
//        ApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("application.xml");
//        Object user1 = classPathXmlApplicationContext.getBean("user");
//        System.out.println(user1);
    }
}
